Skip to content

[FO - Formulaire police] BatId en cas d'adresse forcee#5704

Open
hmeneuvrier wants to merge 3 commits intodevelopfrom
feature/5627-fo---formulaire-police-batid-en-cas-dadresse-forcee
Open

[FO - Formulaire police] BatId en cas d'adresse forcee#5704
hmeneuvrier wants to merge 3 commits intodevelopfrom
feature/5627-fo---formulaire-police-batid-en-cas-dadresse-forcee

Conversation

@hmeneuvrier
Copy link
Copy Markdown
Collaborator

@hmeneuvrier hmeneuvrier commented Apr 10, 2026

Ticket

#5627

Description

Dans le cas de signalements usagers avec une adresse forcée, afficher la modale de selection de batiment à l'usager

Changements apportés

  • Ajout d'une route dans le ServiceSecoursController
  • Ajout de 3 champs cachés dans le step2 (rnbId, lat et lng)
  • Ajout d'un bouton et d'une modale dans le twig
  • Ajout d'une fonction dans le js pour gérer la mise à jour des champs dans le formulaire quand on valide la modale
  • Maj des tests

Pré-requis

Tests

  • Tester le formulaire service secours en adresse manuelle ou pas
  • Vérifier la validation et les erreurs
  • Vérifier l'enregistrement geoloc et rnbId en base

@hmeneuvrier hmeneuvrier changed the title Feature/5627 fo formulaire police batid en cas dadresse forcee [FO - Formulaire police] BatId en cas d'adresse forcee Apr 10, 2026
@sonarqubecloud
Copy link
Copy Markdown

@hmeneuvrier hmeneuvrier marked this pull request as ready for review April 10, 2026 22:25
$hasViolation = true;
}

if ($value instanceof FormServiceSecoursStep2) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

si on fait ça, il faut vérifier que l'adresse est manuelle, sinon ça bloque pour les cas simples

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En effet ca alerte y compris en adresse automatique, je pense cependant qu'il ne faut pas du tout mettre de validation à ce niveau. Vu le peu d'élément obligatoire je ne vois pas pourquoi le rnbId le serait

], Response::HTTP_BAD_REQUEST);
}

if (!$rnbId) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la partie gestion d'erreur pourrait être concaténée dans un service, non ? on a 3 fois les mêmes tests pour ça

{{ form_widget(form.step2.rnbId) }}
{{ form_widget(form.step2.lat) }}
{{ form_widget(form.step2.lng) }}
<button
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

il manque le picto sur le bouton (il faut inclure des css dsfr, il me semble)

{% if current_step == 'step2' %}
<div data-ajax-form>
<form action="{{ sign_url(path('service_secours_complete_localisation', {
'slug': 'ppp',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi ppp ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ben ça devait être chez toi, il faudrait que tu modifies, ça ne fonctionne pas chez moi

Copy link
Copy Markdown
Contributor

@numew numew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le sélecteur de bâtiment ne fonctionne pas.
En se basant sans retouche sur le code de pick-localisation.js ce ne pourras pas etre ok, il intègre un système de cache car il est basé sur une adresse "fixe" enregistré sur la fiche BO, dans notre cas il faudra qu'il puisse se mettre a jour si l'adresse a changé après une seconde ouverture. (je me demande d’ailleurs si une modale était le plus approprié pour ce formulaire secours prévu pour les mobiles, mais j'ai vu que c'est les spec d'arnaud !)

]);
}

#[Route(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je ne comprends pas l'utilité de cette route.
L'information qu'il nous faut stoker c'est le rnbId et on le récupère directement coté JS, si cette données doit être utilisé pour faire un traitement il faut déplacer cela dans la factory.

Il me semble que ca permettrais de simplifier je met des autres com sur les élément à supprimer si on cette option.

attacheAutocompleteAddressEvent,
initComponentAddress,
} from '../../services/component/component_search_address';
import { jsonResponseHandler } from '../../services/component/component_json_response_handler';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus nécessaire si on supprime la route service_secours_complete_localisation


updatePickButton();

const submitBtn = document.getElementById('fr-modal-pick-localisation-submit');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus nécessaire si on supprime la route service_secours_complete_localisation


public ?string $rnbId = null;

public ?float $lat = null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus nécessaire si on supprime la route service_secours_complete_localisation


public ?float $lat = null;

public ?float $lng = null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus nécessaire si on supprime la route service_secours_complete_localisation

->add('rnbId', HiddenType::class, [
'required' => false,
])
->add('lat', HiddenType::class, [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus nécessaire si on supprime la route service_secours_complete_localisation

->add('lat', HiddenType::class, [
'required' => false,
])
->add('lng', HiddenType::class, [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus nécessaire si on supprime la route service_secours_complete_localisation

$hasViolation = true;
}

if ($value instanceof FormServiceSecoursStep2) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En effet ca alerte y compris en adresse automatique, je pense cependant qu'il ne faut pas du tout mettre de validation à ce niveau. Vu le peu d'élément obligatoire je ne vois pas pourquoi le rnbId le serait


{% block body %}
<main class="fr-container fr-mb-5w" id="content">
{% include "flash-messages.html.twig" %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus nécessaire si on supprime la route service_secours_complete_localisation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants